<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=\, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div>红红火火恍恍惚惚</div>
   <script>
    const div  = document.querySelector('div')
    console.log(div.innerText); //打印文本内容
    // 但是innerText无法解析标签
    // div.innerText = '<h1>是被修改后的文本</h1>'
    
    // innerHtml是可以解析标签的
    div.innerHTML = '<h1>哈哈哈哈哈</h1>'
   </script> 
</body>
</html>